package com.ruoyi.web.controller.finance;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.finance.service.IStatisticsService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("api/finance/statistics")
public class statisticsController extends BaseController {

    @Resource
    private IStatisticsService statisticsService;

    /**
     * 按年查询收支情况
     * @param beginTime 开始年
     * @param endTime 结束年
     * @return
     */
    @GetMapping("year")
    public AjaxResult getStatisticsByYear(String beginTime, String endTime) {
        return success(statisticsService.getStatisticsByYear(beginTime,endTime));
    }

    /**
     * 按年查询收支情况
     * @param beginTime 开始年
     * @param endTime 结束年
     * @return
     */
    @GetMapping("month")
    public AjaxResult getStatisticsByMonth(String beginTime, String endTime) {
        return success(statisticsService.getStatisticsByMonth(beginTime,endTime));
    }


    /**
     * 按天查询收支情况
     * @param beginTime 开始年
     * @param endTime 结束年
     * @return
     */
    @GetMapping("day")
    public AjaxResult getStatisticsByDay(String beginTime, String endTime) {
        return success(statisticsService.getStatisticsByDay(beginTime,endTime));
    }
}
